package com.zyh.utils;

/**
 * @Author zyh
 * @Date 2024/8/9 9:35
 * @Description countDownLatch 减法计数器
 */

public class CountDownDemo2 {
    public static void main(String[] args) {
        //创建线程任务
        Runnable task = () -> System.out.println(Thread.currentThread().getName() + "离开教室");
        for (int i = 1; i <= 10; i++) {
            Thread thread = new Thread(task, "学生" + i);
        }
        //创建门卫线程
        Thread t = new Thread(() -> System.out.println(Thread.currentThread().getName() + "关门"), "门卫");
    }
}
